from service.setting_service import DataDictionaryService
from views.common.translator import Translator
from views.template_page_view import BasePageTemplateView, FormItemDto


class CommonSettingView(BasePageTemplateView):

    def __init__(self, parent=None):
        t = Translator()
        super().__init__("CommonSettingView", parent=parent)

        form_items = [
            FormItemDto("总资金量", "setting.stock.money.all", "100000", "int"),
            FormItemDto("Tushare Token", "setting.app.tushare.token", "", "text"),
        ]

        # 添加一个报表
        self.addFromTemplate(form_items, "基础配置表单", self.commonSettingCallback)

    def commonSettingCallback(form_data):
        print("Form Data:", form_data)

        dataMap = DataDictionaryService()
